package com.yunduansing.demo.model.account;

import com.yunduansing.demo.entity.UserEntity;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class LoginUserModel implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private String username;
    private boolean isAdmin;
    private String fullName;
    private int userId;
    private String password;
    private List<String> roles;

    public LoginUserModel(){}

    public LoginUserModel(String account, String fullName, Integer userId, boolean isAdmin) {
        this.username=account;
        this.fullName=fullName;
        this.userId=userId;
        this.isAdmin=isAdmin;

    }

    public LoginUserModel(UserEntity user,List<String> roles){
        this(user.getAccount(),user.getFullName(),user.getId(),user.getIsAdmin());
        this.setPassword(user.getPassword());
        this.roles=roles;
    }
}
